// VersionControllerManager.cpp: implementation of the VersionControllerManager class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "phsshare.h"
#include "VersionControllerManager.h"
#include "Version7Controller.h"

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

namespace VersionControl
{
	IMPLEMENT_SINGLETON(VersionControllerManager);
	VersionControllerManager::VersionControllerManager()
	{
		
	}
	
	VersionControllerManager::~VersionControllerManager()
	{
		
	}

	VersionController* VersionControllerManager::GetVersionController(INT nVersion)
	{
		VersionController* pController = NULL;

		pController = this->GetManaged(nVersion);
		if(pController != NULL)
			return pController;

		pController = NewVersionController(nVersion);
		ASSERT(pController);
		Add(nVersion, pController);

		return pController;
	}

	VersionController* VersionControllerManager::NewVersionController(INT nVersion)
	{
		VersionController* pController = NULL;
		switch(nVersion)
		{
		case 7:
			pController = new Version7Controller;
			break;
		default:
			ASSERT(FALSE);
		}

		return pController;
	}
}